#{extends 'mainStage.html' /}

#{set title:'Liste des stages' /}
#{if isStage}
    <div class="post">
        <div class="post">
            <h2 class="post-title">
                Liste des stages
            </h2>
            <br>
            <table cellpadding="0" cellspacing="0" border="0" class="display" id="liste"> 
        		<thead>
        			<tr>
        				<th>Intitule</th>	
        				<th>Date de D&eacute;but</th>
        				<th>Dur&eacute;e</th>
        				<th>Structure Organisatrice</th>
        				<th>Lieu</th>
        				<th>Condition de d&eacute;roulement</th>
        				<th>Nombre de place disponible</th>
        				<th>Etat</th>
        				<th>Candidater</th>		
        			</tr>
        		</thead>		

                <tbody>
        	    #{list items:stages, as:'stage' } 
        	       <tr>
        	            <td> 
                            <a href="@{Stages.detailStage(stage.id)}">${stage.intitule}</a>
        	            </td>
        	            
        	            <td> 
                            #{if stage.dateDeb == null}
                                -
        	                #{/if}
                            #{else}
        	                    ${stage.dateDeb.format('dd MMMM yyyy', 'fr')}
                            #{/else}
        	            </td>
        	            
        	            <td> 
                            ${stage.duree}
        	            </td>
        	            
        	            <td> 
                            ${stage.structure}
        	            </td>
        	            
        	            <td> 
                            #{if stage.cis == null}
                                -
        	                #{/if}
                            #{else}
        	                    ${stage.cis}
                            #{/else}
        	            </td>
        	            
        	            <td> 
                            #{if stage.modalites == null}
                                -
        	                #{/if}
                            #{else}
        	                    ${stage.modalites}
                            #{/else}
        	            </td>
        	            
        	            <td> 
                            #{if stage.getEffectif() == null}
                                -
        	                #{/if}
                            #{elseif stage.effectifMax != null}
        	                    	${stage.effectifMax-stage.getEffectif()}
                            #{/elseif}
        	            </td>
        	            
        	            <td> 
        	                ${stage.etat}
        	            </td>
        	           	
        	           	<td style="margin-top:30px">    
        	   			 #{form @candidStage(stage.id)}    
        	            #{if (stage.etat.nom.equals("Candidatures clôturées"))}  
       	 				-		
        	             #{/if} 
        	             #{else} 
        	              #{if (stage.dateDeb>aujourdhui) || stage.dateDeb==null} 
        	               
        	              <input type="submit" value="Candidater" />
       	 	
        	             #{/if}   
        	             #{/else}
        	               #{/form}
        	           </td>
        	       </tr>
        	       
        	       
        	    #{/list}
        	    </tbody>
        	</table>
        </div>
    </div>    
#{/if}
 
#{else}
    <div class="empty">
        Pas de stage.
    </div>
#{/else}
